<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<div id="app">
		  <div>表单的内容是： <h3 id="title">   </h3> </div>  
			<input type="text" id="txt" />
			
		</div>
		
		
		<script>
			
	var title=document.getElementById('title');    
	 var txt=document.getElementById("txt");		
	
	var obj={
		val:txt.value
	}		
	
	var proxy=new Proxy(obj,{
		set(target,key,val){
			title.innerText=val;
			txt.value=val;
		},
		get(target,propkey){
			title.innerText=target[propkey]
			return target[propkey]
		}
	})
   txt.oninput=function(){
	   proxy.val=this.value
   }			
			
			
			
		</script>
	</body>
</html>
